package com.library.service.impl;

import com.library.common.core.domain.AjaxResult;
import com.library.common.utils.QRCodeUtil;
import com.library.common.utils.file.FileUploadUtils;
import com.library.common.utils.sign.Base64;
import com.library.service.IQrCodeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.io.ByteArrayOutputStream;


/**
 * @author wanghongjie
 */
@Slf4j
@Service
public class QrCodeServiceImpl implements IQrCodeService {
    @Override
    public byte[] createQrCode(String content) {
        try {
            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
            QRCodeUtil.encode(content, outputStream);
            return outputStream.toByteArray();
        } catch (Exception e) {
            log.error("qrCode create is error ", e);
            return null;
        }
    }
}
